<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('项目工程款进度列表')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">项目工程款</li>
    </ol>
    <div class="aLine"></div>
</div>
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <label>催款金额：</label>-->
<!--                                <input type="text" name="pfmPrice"/>-->
<!--                            </li>-->
                            <li class="select-time">
                                <label>创建时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeh   older="结束时间" name="params[endPTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:applications:exports">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" style="color: black; font-size: 15px"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
    <script th:inline="javascript">

        var editFlag = [[${@permission.hasPermi('ruoyi:application:edit')}]];
        var removeFlag = [[${@permission.hasPermi('ruoyi:application:remove')}]];
        var prefixss = ctx + "system/building";
        var prefixs = ctx + "ruoyi/agr";
        var prefix = ctx+"ruoyi/from"
        $(function() {
            var options = {
                url: prefixss + "/list",
                exportUrl: prefix+ "/exports",
                modalName: "项目工程款进度",
                mobileResponsive: false,
                cardView: true,
                showColumns: false,
                detailView: true,
                striped: true,
                sortName:'pTime',
                sortOrder:'desc',
                rowStyle:{
                    css:{"height":"50px"}
                },
               // detailUrl:prefix+"/application",
                onExpandRow: function (index, row, $detail) {
                    initChildTable(index, row, $detail);
                },
                columns: [
                {
                    field: 'pId',
                    title: '项目id',
                    visible: false
                },
                {
                    field: 'pName',
                    title: '项目名称'
                },
                {
                    field:'pTime',
                    title:'项目创建时间',
                    sortable:true
                }]
            };
            $.table.init(options);
        });
        initChildTable = function(index, row, $detail) {
            var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');

            $(childTable).bootstrapTable({
                url: prefixs + "/lists/" + row.pId,
                method: 'post',
                sidePagination: "server",
                contentType: "application/x-www-form-urlencoded",
                showFooter: true,
                rowStyle:{
                    css:{"background":"lightyellow"}
                },
                columns: [
                    {
                        field: 'pContractParty',
                        title: '甲方名称',
                        width: 100,
                    },
                    {
                        field: 'pFileName',
                        title: '合同名称',
                        width: 100,
                    },
                    {
                        //field: 'pMoney',
                        title: '合同金额',
                        width: 100,
                        formatter: function(value, row, index) {
                            var actions = [];
                            actions.push('￥'+row.pMoney);
                            return actions.join('');
                        },
                        footerFormatter:function (value) {
                            var sun = 0;
                            for (var i in value) {
                                sun += parseFloat(value[i].pMoney)
                            }
                            return  "总金额：￥"+sun;
                        },
                    },
                    {
                        field: 'pRemark',
                        title: '备注',
                        width: 100,
                    },
                    {
                        align: 'center',
                        width: 100,
                        formatter: function(value, rows, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="clicks(\'' + rows.pId + '\')"><i class="fa fa-edit"></i>合同明细</a> ');
                            // actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + rows.pId + '\')"><i class="fa fa-edit"></i>明细</a> ');
                            return actions.join('');
                        }
                    }]
            });
        };
        function clicks(pId) {
            var url  =  ctx + "ruoyi/applications/applications/" + pId;
            $.modal.openTab("项目工程款明细",url);
        }
    </script>
</body>
</html>